package com.zzyl.task;

import com.zzyl.service.ReservationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @className: ReservationTask
 * @description:
 * @author: InnovatorX
 * @date: 2024/6/1 10:06
 * @Version: 1.0
 */
@Slf4j
@Component
public class ReservationTask {
    @Autowired
    private ReservationService reservationService;
    /**
     * 每小时的10和40分钟让预约任务过期
     * @return
     */
    @Scheduled(cron = "0 10,40 0 * * ?")
    public void cancelReservation() {
        log.info("定时任务开始执行");
        reservationService.overdueReservation();
    }
}
